// pages/home/index.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    swiperList: [
      {
        src: 'https://vdse.bdstatic.com//dacb00ed635231e094170c9acd6c387e.mp4',
      },
      {
        src: 'https://vdse.bdstatic.com//c39b930dcb505c5dc9cdfae7f3463eba.mp4',
      },
      {
        src: 'https://vdse.bdstatic.com//566b58cced16ca32538979b05a164139.mp4',
      },
      {
        src: 'https://vdse.bdstatic.com//106d66063b550ea1a38267971f965dd8.mp4',
      },
      {
        src: 'https://vdse.bdstatic.com//0e4f9701ba484a4a6356b44abde5f25d.mp4',
      },
      {
        src: 'https://vdse.bdstatic.com//502d0c6ea629d7c8f8c7110bcc1ff3ec.mp4',
      },
      {
        src: 'https://vdse.bdstatic.com//dfc30ab48b7e8f1643691892982c7caf.mp4',
      },
    ],
  },

  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0,
      });
    }
  },

  handeChange(e) {
    const { currentIndex } = e.detail;
    const { swiperList } = this.data;
    if (currentIndex == swiperList.length - 2) {
      console.log('快最后一条啦');
      const list = [
        {
          src: 'https://vdse.bdstatic.com//566b58cced16ca32538979b05a164139.mp4',
        },
        {
          src: 'https://vdse.bdstatic.com//106d66063b550ea1a38267971f965dd8.mp4',
        },
        {
          src: 'https://vdse.bdstatic.com//0e4f9701ba484a4a6356b44abde5f25d.mp4',
        },
      ];
      this.setData({
        swiperList: swiperList.concat(list),
      });
    }
  },
});
